
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 05/17/2013 02:06:23
-- Generated from EDMX file: C:\Users\tommy ma\Documents\Visual Studio 2012\Projects\Database\Logistics.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [logistics];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------


-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------


-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'warehouses'
CREATE TABLE [dbo].[warehouses] (
    [Code] nvarchar(max)  NOT NULL,
    [Description] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'areas'
CREATE TABLE [dbo].[areas] (
    [code] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'divs'
CREATE TABLE [dbo].[divs] (
    [Id] int IDENTITY(1,1) NOT NULL
);
GO

-- Creating table 'shells'
CREATE TABLE [dbo].[shells] (
    [Id] int IDENTITY(1,1) NOT NULL
);
GO

-- Creating table 'dcs'
CREATE TABLE [dbo].[dcs] (
    [Id] int IDENTITY(1,1) NOT NULL
);
GO

-- Creating table 'users'
CREATE TABLE [dbo].[users] (
    [Id] int IDENTITY(1,1) NOT NULL
);
GO

-- Creating table 'accesses'
CREATE TABLE [dbo].[accesses] (
    [Id] int IDENTITY(1,1) NOT NULL
);
GO

-- Creating table 'modules'
CREATE TABLE [dbo].[modules] (
    [Id] int IDENTITY(1,1) NOT NULL
);
GO

-- Creating table 'suppliers'
CREATE TABLE [dbo].[suppliers] (
    [Id] int IDENTITY(1,1) NOT NULL
);
GO

-- Creating table 'payers'
CREATE TABLE [dbo].[payers] (
    [Id] int IDENTITY(1,1) NOT NULL
);
GO

-- Creating table 'bills'
CREATE TABLE [dbo].[bills] (
    [Id] int IDENTITY(1,1) NOT NULL
);
GO

-- Creating table 'actions'
CREATE TABLE [dbo].[actions] (
    [Id] int IDENTITY(1,1) NOT NULL
);
GO

-- Creating table 'events'
CREATE TABLE [dbo].[events] (
    [Id] int IDENTITY(1,1) NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [Code] in table 'warehouses'
ALTER TABLE [dbo].[warehouses]
ADD CONSTRAINT [PK_warehouses]
    PRIMARY KEY CLUSTERED ([Code] ASC);
GO

-- Creating primary key on [code] in table 'areas'
ALTER TABLE [dbo].[areas]
ADD CONSTRAINT [PK_areas]
    PRIMARY KEY CLUSTERED ([code] ASC);
GO

-- Creating primary key on [Id] in table 'divs'
ALTER TABLE [dbo].[divs]
ADD CONSTRAINT [PK_divs]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'shells'
ALTER TABLE [dbo].[shells]
ADD CONSTRAINT [PK_shells]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'dcs'
ALTER TABLE [dbo].[dcs]
ADD CONSTRAINT [PK_dcs]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'users'
ALTER TABLE [dbo].[users]
ADD CONSTRAINT [PK_users]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'accesses'
ALTER TABLE [dbo].[accesses]
ADD CONSTRAINT [PK_accesses]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'modules'
ALTER TABLE [dbo].[modules]
ADD CONSTRAINT [PK_modules]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'suppliers'
ALTER TABLE [dbo].[suppliers]
ADD CONSTRAINT [PK_suppliers]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'payers'
ALTER TABLE [dbo].[payers]
ADD CONSTRAINT [PK_payers]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'bills'
ALTER TABLE [dbo].[bills]
ADD CONSTRAINT [PK_bills]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'actions'
ALTER TABLE [dbo].[actions]
ADD CONSTRAINT [PK_actions]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'events'
ALTER TABLE [dbo].[events]
ADD CONSTRAINT [PK_events]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------